powered by
Cross validation for the kernel regression with Euclidean response data.
kernreg.tune(y, x, h = seq(0.1, 1, length = 10), type = "gauss", nfolds = 10, folds = NULL, seed = NULL, graph = FALSE, ncores = 1)
A matrix or a vector with the Euclidean response.
A matrix with the available predictor variables.
A vector with the bandwidth value(s) \(h\) to consider.
The type of kernel to use, "gauss" or "laplace".
The number of folds. Set to 10 by default.
If you have the list with the folds supply it here. You can also leave it NULL and it will create folds.
You can specify your own seed number here or leave it NULL.
If graph is TRUE (default value) a plot will appear.
The number of cores to use. Default value is 1.
A list including:
The mean squared prediction error (MSPE) for each fold and value of \(h\).
The optimal \(h\) that leads to the minimum MSPE.
The minimum MSPE.
The runtime of the cross-validation procedure.
A k-fold cross validation for the kernel regression with a euclidean response is performed.
Wand M. P. and Jones M. C. (1994). Kernel smoothing. CRC press.
kern.reg, aknnreg.tune, aknn.reg
# NOT RUN { y <- iris[, 1] x <- iris[, 2:4] mod <- kernreg.tune(y, x, h = c(0.1, 0.2, 0.3) ) # }
Run the code above in your browser using DataLab